builder-tool: Set the parent of newly created GtkAssistantPage
authorLubomir Rintel <lkundrak@v3.sk>
Thu, 30 May 2019 09:29:50 +0000 (11:29 +0200)
committerLubomir Rintel <lkundrak@v3.sk>
Thu, 30 May 2019 09:39:09 +0000 (11:39 +0200)
...and its property. Otherwise simplify_element() blows up when looking
up the hierarchy to determine a property type.

  $ gtk4-builder-tool simplify --3to4 /dev/stdin <<EOF
  > <?xml version="1.0" encoding="UTF-8"?>
  > <!-- Generated with glade 3.20.2 -->
  > <interface domain="nm-applet">
  >   <object class="GtkAssistant">
  >     <child>
  >       <object class="GtkBox" id="confirm_page">
  >       </object>
  >       <packing>
  >         <property name="page_type">confirm</property>
  >         <property name="complete">True</property>
  >       </packing>
  >     </child>
  >   </object>
  > </interface>
  > EOF
  /dev/stdin: Packing property GtkAssistant::page_type not found
  /dev/stdin: Packing property GtkAssistant::complete not found
  Segmentation fault (core dumped)

gtk/tools/gtk-builder-tool-simplify.c

index 776496ca4a2cc4fc12b7decac40654c1a7a3391a..5919d9d7f7fd4563e24537b147ab9176a4ce2df7 100644 (file)
@@ -852,6 +852,7 @@ rewrite_assistant_child (Element *child, MyParserData *data)
   new_object->attribute_values = g_new0 (char *, 2);
   new_object->attribute_values[0] = g_strdup ("GtkAssistantPage");
   new_object->children = packing->children;
+  new_object->parent = child;
   packing->children = NULL;
 
   prop = g_new0 (Element, 1);
@@ -861,6 +862,7 @@ rewrite_assistant_child (Element *child, MyParserData *data)
   prop->attribute_values = g_new0 (char *, 2);
   prop->attribute_values[0] = g_strdup ("child");
   prop->children = g_list_append (prop->children, object);
+  prop->parent = new_object;
   new_object->children = g_list_append (new_object->children, prop);
       
   g_list_free (child->children);